package de.hfu.android;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

public class MainActivity extends Activity {
    private static final int MENU_SETTINGS = 0;

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        PreferenceManager.setDefaultValues(this, R.xml.preferences, true);
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        
        Intent intent = new Intent(this, WeekViewActivity.class);
        startActivity(intent);
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
//    	menu.add(0, MENU_SETTINGS, 0, "Settings");
    	MenuInflater inflater = getMenuInflater();
    	inflater.inflate(R.menu.menu, menu);
    	return true;
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {    	
//    	if (item.getItemId() == MENU_SETTINGS) {
//    		Intent i = new Intent(this, SettingActivity.class);
//    		startActivity(i);
//    		return true;
//    	}
    	switch (item.getItemId()) {
		case R.id.menu_settings:
			Intent i = new Intent(this, SettingActivity.class);
    		startActivity(i);
			return true;
			
		default:
			break;
		}
    	return super.onOptionsItemSelected(item);
    }
}